class Solution {
public:
    double minimumAverage(vector<int>& nums)
    {
        double ans = INT_MAX;
        sort(nums.begin(), nums.end());
        for (int left = 0, right = nums.size() - 1; left < right; left++, right--)
            ans = min(ans, (double)((nums[right] + nums[left]) / 2.0));
        return ans;
    }
};